using System;
using UnityEngine;
using UnityEngine.Events;

namespace Voodoo.Utils
{
	public static class DelayManager
	{
		public static DelayAction CreateDelayer(Action action, float delay)
		{
			DelayAction delayAction = new GameObject
			{
				name = "Delayer : Pending"
			}.AddComponent<DelayAction>();
			delayAction.SetAction(action);
			delayAction.SetDelay(delay);
			return delayAction;
		}

		public static DelayAction CreateDelayer(UnityAction unityAction, float delay)
		{
			return CreateDelayer((Action)unityAction.Invoke, delay);
		}

		public static Delay CreateDelayer(float delay)
		{
			Delay delay2 = new GameObject
			{
				name = "Delayer : Pending"
			}.AddComponent<Delay>();
			delay2.SetDelay(delay);
			return delay2;
		}
	}
}
